IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[GetFwkDomainOrganizationId]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[GetFwkDomainOrganizationId]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO


/***************************************************************************
* Name:			GetFwkDomainOrganizationId
* Purpose:		Returns the fwkDomainOrganizationId for the given institution and the chiefcode. 
*
*
* PARAMETERS
* Name			Description					
* -------------		-----------------------------------------------------------
* @institutionId
* @chiefCode
***************************************************************************/

CREATE PROCEDURE dbo.[GetFwkDomainOrganizationId]
(
	@institutionId INT,
	@chiefCode VARCHAR(10)
)
AS
BEGIN
	SET NOCOUNT ON

	select id from dbo.FwkDomainOrganization
	where institutionid = @institutionId
	and chiefcode = @chiefCode

	SET NOCOUNT OFF
END

GO
